#include <iostream>
#include "CloudiskServer.h"
#include <signal.h>
#include <workflow/WFFacilities.h>

WFFacilities::WaitGroup g_waitGroup { 1 };

void sig_handler(int)
{
    g_waitGroup.done();
}

int main()
{
    signal(SIGINT, sig_handler);    

    CloudiskServer server {};

    // 注册路由
    server.register_modules();
    
    if (server.track().start(8888) == 0) {
        server.list_routes();
        g_waitGroup.wait();
        server.stop();
    } else {
        std::cerr << "Error: Server start failed!\n";
    }
}
